Hooks:PostHook(CopDamage, "die", "manually_execute_death_sequence_fuck_pdmod", function(self, attack_data)

	--stolen from cpone xD 
	--presume it's okay to use, hate doing this but it's the only method i know how to do to fix that god awful fucking issue where materials get fucked up upon killing a marked enemy like a commander
	
	CopDamage._dead_material_translation_map = {}

	local character_path = ""
	local character_path_ids = Idstring("")
	local char_map = tweak_data.character.character_map()

	for _, data in pairs(char_map) do
		for _, character in ipairs(data.list) do
			character_path = data.path .. character .. "/" .. character
			character_path_ids = Idstring(character_path)

			CopDamage._dead_material_translation_map[tostring(Idstring(character_path):key())] = character_path_ids
			CopDamage._dead_material_translation_map[tostring(Idstring(character_path .. "_contour"):key())] = character_path_ids
		end
	end

	local function add_lookup(character_path)
		CopDamage._dead_material_translation_map[tostring(Idstring(character_path):key())] = Idstring(character_path)
		CopDamage._dead_material_translation_map[tostring(Idstring(character_path .. "_contour"):key())] = Idstring(character_path)
	end

	local new_material = self._dead_material_translation_map[tostring(self._unit:material_config():key())]
	
	self._unit:set_material_config(new_material, true)
				
	self._unit:base():on_material_applied()

	self._unit:base()._is_in_original_material = true

	--doing this to avoid .unit file editing because they forgot it for these folks
	local missing_death_sequence = {
	  "german_fallschirmjager_heavy_mp38",
	  "german_fallschirmjager_heavy_kar98",
	  "german_fallschirmjager_heavy_shotgun",
	  "german_gebirgsjager_heavy_mp38",
	  "german_gebirgsjager_heavy_kar98",
	  "german_gebirgsjager_heavy_shotgun",
	  "german_grunt_heavy_mp38",
	  "german_grunt_heavy_kar98",
	  "german_grunt_heavy_shotgun",
	  "german_heavy_kar98",
	  "german_heavy_shotgun",
	  "german_fallschirmjager_light_mp38",
	  "german_fallschirmjager_light_kar98",
	  "german_fallschirmjager_light_shotgun"
	}
        
	if table.contains(missing_death_sequence, self._unit:base()._tweak_table) then
		if self._unit:damage() and self._unit:damage():has_sequence("death") then
			self._unit:damage():run_sequence_simple("death")
		end
	end
end)